package com.csair.platform.cit.service.controller;

import com.csair.platform.cit.service.core.CheckDataPermission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.csair.invoice.common.base.vo.JsonResult;
import com.csair.platform.cit.facade.InitDataApi;
import com.csair.platform.cit.facade.model.CitQueryParam;
import com.csair.platform.cit.facade.model.InitDataVo;
import com.csair.platform.cit.service.biz.IA202000Service;
import com.csair.platform.cit.service.biz.InitDataService;
import com.csair.platform.cit.service.core.CheckAnyPermission;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

/**
 * 企业所得税期初数据接口
 * @author liaoxiaojin
 *
 */
@Api(tags = "企业所得税期初数据")
@Slf4j
@RestController
public class InitDataController extends BaseController implements InitDataApi {

    /**
     * [期初数据]服务
     */
    @Autowired
    InitDataService initDataService;

    /**
     * [分配表数据]服务
     */
    @Autowired
    IA202000Service a202000Service;
    
    /**
     * 获取主表期初数据
     */
    @CheckDataPermission
    @CheckAnyPermission(values={"qysds", "citReport"})	
    @ApiOperation(value = "获取主表期初数据")
    @Override
    public JsonResult<InitDataVo> getInitData(@RequestBody CitQueryParam param) {
    	log.info("获取[主表期初数据]，请求参数:{}", JSON.toJSONString(param)); 
        return initDataService.getInitData(param, getCurrentUser());
    }

    /**
     * 获取分支机构所得税分配表
     */
    @CheckDataPermission
    @CheckAnyPermission(values={"qysds", "citReport"})	
    @ApiOperation(value = "获取分支机构所得税分配表")
    @Override
    public JsonResult<JSONObject> getA202000InitData(@RequestBody CitQueryParam param) {
    	log.info("获取[分支机构所得税分配表]，请求参数:{}", JSON.toJSONString(param)); 
        return a202000Service.getInitData(param, getCurrentUser(), false);
    }
}
